/* 🦆 Card Collection (Gallery) — card-game album look (Hearthstone / Shadowverse style). */
#cc-root { position: fixed; inset: 0; z-index: 9000; display: none; color: #f5ead2; font-family: inherit; overflow: hidden; user-select: none; }
#cc-root.open { display: flex; flex-direction: column; }
#cc-root button { font-family: inherit; }
.cc-bg { position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(120,72,30,.35), transparent 65%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.015) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #2a1a10 0%, #1a100a 60%, #0e0906 100%); }
.cc-bg::after { content: ''; position: absolute; inset: 10px; border: 2px solid rgba(214,170,92,.35); border-radius: 14px; box-shadow: inset 0 0 60px rgba(0,0,0,.7); pointer-events: none; }

/* top bar */
.cc-top { display: flex; align-items: center; gap: 18px; padding: 16px 28px 6px; }
.cc-title { display: flex; flex-direction: column; }
.cc-kicker { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #d6aa5c; }
.cc-title b { font-size: 24px; color: #ffe7b0; text-shadow: 0 2px 0 #000, 0 0 14px rgba(255,190,90,.35); }
.cc-progress { flex: 1; display: flex; align-items: center; gap: 12px; max-width: 460px; margin-left: auto; }
.cc-prog-num { font-size: 20px; font-weight: 800; color: #ffe7b0; white-space: nowrap; }
.cc-prog-num small { font-size: 13px; color: #b9a27a; }
.cc-prog-bar { flex: 1; height: 10px; border-radius: 6px; background: #120b06; border: 1px solid #6b4c22; overflow: hidden; }
.cc-prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, #b07a2a, #ffd27a); box-shadow: 0 0 10px #ffcf6a; }
.cc-prog-pct { font-size: 13px; color: #d6aa5c; width: 40px; }
.cc-top-btns { display: flex; gap: 8px; }
.cc-btn { cursor: pointer; padding: 8px 14px; border-radius: 8px; border: 1px solid #a57b3a; color: #ffe7b0; font-weight: 700; font-size: 13px;
  background: linear-gradient(180deg, #5b3b1c, #3a2410); box-shadow: inset 0 1px 0 rgba(255,220,150,.25), 0 2px 6px rgba(0,0,0,.6); }
.cc-btn:hover { filter: brightness(1.2); }
.cc-close { border-color: #c77; background: linear-gradient(180deg, #6b2626, #3d1212); }

/* character tabs */
.cc-tabs { display: flex; gap: 6px; padding: 6px 28px; overflow-x: auto; scrollbar-width: thin; }
.cc-tab { position: relative; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; padding: 0; cursor: pointer; border: 2px solid #6b4c22; background: #1c120a; overflow: hidden; opacity: .7; transition: transform .15s, opacity .15s; }
.cc-tab:hover { opacity: 1; transform: translateY(-2px); }
.cc-tab.on { opacity: 1; border-color: #ffd27a; box-shadow: 0 0 10px rgba(255,210,122,.7); }
.cc-tab.done { border-color: #e8c46a; }
.cc-tab-face { position: absolute; inset: 0; background-size: 220%; background-position: 50% 12%; }
.cc-tab-all { font-weight: 900; font-size: 12px; color: #ffe7b0; }
.cc-tab-dot { position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 6px #4ade80; }

/* filter row */
.cc-filters { display: flex; align-items: center; gap: 14px; padding: 6px 28px 4px; }
.cc-cur { font-size: 17px; font-weight: 800; color: #ffe7b0; margin-right: auto; }
.cc-cur small { font-size: 12px; color: #b9a27a; margin-left: 6px; }
.cc-seg { display: inline-flex; border: 1px solid #6b4c22; border-radius: 8px; overflow: hidden; }
.cc-seg button { cursor: pointer; padding: 6px 14px; border: 0; background: #22160c; color: #c9b38a; font-size: 13px; font-weight: 700; }
.cc-seg button.on { background: linear-gradient(180deg, #8a5d26, #5b3b1c); color: #fff2cf; }
.cc-toggle { cursor: pointer; padding: 6px 10px; border-radius: 8px; border: 1px solid #6b4c22; background: #22160c; color: #c9b38a; font-size: 13px; }
.cc-toggle.on { color: #fff2cf; border-color: #d6aa5c; }

/* the book */
.cc-book { flex: 1; min-height: 0; display: flex; align-items: center; gap: 10px; padding: 4px 18px; }
.cc-grid { flex: 1; height: 100%; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); gap: 14px 18px; justify-items: center; align-items: center; perspective: 900px; }
.cc-empty { grid-column: 1 / -1; grid-row: 1 / -1; color: #b9a27a; font-size: 15px; text-align: center; }
.cc-arrow { flex: 0 0 auto; width: 46px; height: 90px; border-radius: 10px; cursor: pointer; font-size: 44px; line-height: 1; color: #ffe7b0; border: 1px solid #a57b3a; background: linear-gradient(180deg, #5b3b1c, #2f1d0d); box-shadow: 0 3px 10px rgba(0,0,0,.6); }
.cc-arrow:disabled { opacity: .25; cursor: default; }
.cc-pager { text-align: center; font-size: 12px; color: #b9a27a; padding: 2px 0 14px; letter-spacing: .1em; }
.cc-slot { height: 92%; aspect-ratio: 2 / 3; border-radius: 12px; border: 2px dashed rgba(214,170,92,.15); }

/* a card */
.cc-card { --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%; --gc: #3b82f6; --fc1: #ffe29a; --fc2: #9a6a24;
  position: relative; height: 92%; max-height: 100%; aspect-ratio: 2 / 3; padding: 0; border: 0; background: none; cursor: pointer;
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; transition: transform .12s ease-out; }
.cc-card:hover { z-index: 2; }
.cc-card.got:hover .cc-card-in { transform: translateZ(26px) scale(1.04); box-shadow: 0 18px 30px rgba(0,0,0,.75), 0 0 22px var(--gc); }
.cc-card-in { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; transition: transform .15s, box-shadow .15s;
  background: #0c0806; box-shadow: 0 8px 18px rgba(0,0,0,.7); }
.cc-art { position: absolute; inset: 5px; border-radius: 8px; overflow: hidden; background: #000; }
.cc-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }
.cc-frame { position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  border: 5px solid transparent; background: linear-gradient(145deg, var(--fc1), var(--fc2) 45%, var(--fc1) 70%, var(--fc2)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.cc-gem { position: absolute; top: -2px; left: -2px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 16px; color: #fff; text-shadow: 0 1px 2px #000; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 6%, var(--gc) 30%, #000 100%); border: 3px solid var(--fc1); box-shadow: 0 2px 6px #000; }
.cc-state { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 800;
  background: rgba(0,0,0,.65); border: 1px solid var(--fc1); color: #ffe7b0; }
.cc-banner { position: absolute; left: 8px; right: 8px; bottom: 10px; padding: 5px 6px 4px; text-align: center; border-radius: 6px;
  background: linear-gradient(180deg, rgba(60,36,14,.92), rgba(26,15,6,.95)); border: 1px solid var(--fc1); box-shadow: 0 -2px 8px rgba(0,0,0,.6); }
.cc-name { display: block; font-size: 14px; font-weight: 900; color: #fff3d1; text-shadow: 0 1px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-skin { display: block; font-size: 10px; color: #d6aa5c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-no { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font-size: 8px; color: rgba(255,231,176,.55); }
.cc-shine { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: 0; transition: opacity .2s;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.35), transparent 45%),
              linear-gradient(115deg, transparent 35%, rgba(255,240,200,.22) 50%, transparent 65%); }
.cc-card.got:hover .cc-shine { opacity: 1; }
.cc-new { position: absolute; top: 40px; left: -4px; padding: 2px 8px; font-size: 11px; font-weight: 900; color: #052e16; border-radius: 0 6px 6px 0;
  background: linear-gradient(90deg, #4ade80, #bbf7d0); box-shadow: 0 0 10px #4ade80; animation: cc-pulse 1.4s ease-in-out infinite; }
@keyframes cc-pulse { 50% { filter: brightness(1.4); } }

/* rarity colours by variant */
.cc-card.at-base { --gc: #3b82f6; }
.cc-card.at-H { --gc: #ec4899; --fc1: #ffc6e3; --fc2: #9d2f68; }
.cc-card.at-X { --gc: #ef4444; --fc1: #ffb4a0; --fc2: #8a2414; }
.cc-card.at-M { --gc: #22c55e; --fc1: #c9f5b0; --fc2: #2f6a1c; }
.cc-card.at-T { --gc: #a855f7; --fc1: #e5c8ff; --fc2: #5b2391; }

/* locked = never appeared in battle: grey filter */
.cc-card.locked { cursor: not-allowed; }
.cc-card.locked .cc-art img { filter: grayscale(1) brightness(.35) blur(1.5px); }
.cc-card.locked .cc-frame { --fc1: #8b8b8b; --fc2: #3a3a3a; filter: grayscale(1); }
.cc-card.locked .cc-gem, .cc-card.locked .cc-state, .cc-card.locked .cc-banner { filter: grayscale(1) brightness(.7); }
.cc-lock { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); font-size: 30px; opacity: .8; filter: grayscale(1); }
.cc-card.shake { animation: cc-shake .35s; }
@keyframes cc-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* inspect */
.cc-inspect { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 36px;
  background: rgba(5,3,2,.82); backdrop-filter: blur(4px); animation: cc-fade .2s; }
@keyframes cc-fade { from { opacity: 0; } }
.cc-ins-card { height: 82vh; max-height: 640px; cursor: default; animation: cc-pop .3s cubic-bezier(.2,1.4,.4,1); }
@keyframes cc-pop { from { transform: scale(.6) rotateY(-25deg); opacity: 0; } }
.cc-ins-card .cc-gem { width: 52px; height: 52px; font-size: 24px; }
.cc-ins-card .cc-name { font-size: 22px; }
.cc-ins-card .cc-skin { font-size: 13px; }
.cc-ins-card .cc-state { font-size: 14px; }
.cc-ins-card .cc-card-in { box-shadow: 0 0 40px var(--gc), 0 20px 40px #000; }
.cc-ins-info { width: 280px; padding: 20px; border-radius: 12px; border: 1px solid #a57b3a; background: linear-gradient(180deg, rgba(60,36,14,.95), rgba(20,12,6,.95)); }
.cc-ins-name { font-size: 26px; font-weight: 900; color: #ffe7b0; }
.cc-ins-skin { font-size: 14px; color: #d6aa5c; margin-bottom: 8px; }
.cc-ins-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(214,170,92,.2); font-size: 14px; }
.cc-ins-row span { color: #b9a27a; }
.cc-ins-btns { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.cc-fullart { position: absolute; inset: 0; z-index: 6; background: #000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.cc-fullart img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* unlock toast (in battle) */
#cc-toasts { position: fixed; left: 16px; bottom: 16px; z-index: 9500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.cc-toast { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 10px; color: #ffe7b0;
  background: linear-gradient(90deg, rgba(60,36,14,.96), rgba(26,15,6,.92)); border: 1px solid #d6aa5c; box-shadow: 0 0 16px rgba(255,200,100,.4);
  animation: cc-toast-in .35s cubic-bezier(.2,1.4,.4,1); transition: opacity .5s, transform .5s; }
.cc-toast.out { opacity: 0; transform: translateX(-30px); }
.cc-toast img { width: 36px; height: 54px; object-fit: cover; object-position: 50% 15%; border-radius: 4px; border: 1px solid #d6aa5c; }
.cc-toast-k { font-size: 11px; color: #4ade80; font-weight: 800; }
.cc-toast-n { font-size: 13px; font-weight: 800; }
@keyframes cc-toast-in { from { opacity: 0; transform: translateX(-40px); } }

/* phone layout */
html.m .cc-top { padding: 6px 12px 2px; gap: 10px; }
html.m .cc-title b { font-size: 16px; }
html.m .cc-kicker { display: none; }
html.m .cc-prog-num { font-size: 14px; }
html.m .cc-btn { padding: 5px 9px; font-size: 11px; }
html.m .cc-tabs { padding: 2px 12px; gap: 4px; }
html.m .cc-tab { width: 30px; height: 30px; }
html.m .cc-tab-all { font-size: 9px; }
html.m .cc-filters { padding: 2px 12px; gap: 8px; }
html.m .cc-cur { font-size: 12px; }
html.m .cc-seg button, html.m .cc-toggle { padding: 3px 8px; font-size: 11px; }
html.m .cc-book { padding: 2px 6px; gap: 4px; }
html.m .cc-grid { gap: 6px 10px; }
html.m .cc-arrow { width: 28px; height: 60px; font-size: 28px; }
html.m .cc-pager { padding: 0 0 4px; font-size: 10px; }
html.m .cc-gem { width: 22px; height: 22px; font-size: 11px; border-width: 2px; }
html.m .cc-state { font-size: 8px; top: 4px; right: 4px; padding: 1px 5px; }
html.m .cc-banner { left: 4px; right: 4px; bottom: 6px; padding: 2px 3px; }
html.m .cc-name { font-size: 10px; }
html.m .cc-skin { font-size: 7px; }
html.m .cc-no { display: none; }
html.m .cc-frame { border-width: 3px; }
html.m .cc-art { inset: 3px; }
html.m .cc-new { top: 24px; font-size: 8px; padding: 1px 5px; }
html.m .cc-lock { font-size: 18px; }
html.m .cc-ins-card { height: 86vh; }
html.m .cc-ins-info { width: 220px; padding: 12px; }
html.m .cc-ins-name { font-size: 18px; }
html.m .cc-ins-row { font-size: 12px; padding: 4px 0; }
html.m .cc-inspect { gap: 16px; }
